package android.chatApp;

import android.app.Activity;
import android.chatApp.R;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;

public class MyChatAppActivity extends Activity implements OnClickListener{
    /** Called when the activity is first created. */
	
	private Button btnSignIn;
	private Button btnReset;
	private EditText txtId;
	private EditText txtPassword;
	
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        this.btnSignIn = (Button)this.findViewById(R.id.btnSignIn);
        this.btnReset = (Button) this.findViewById(R.id.btnReset);
        
        this.btnSignIn.setOnClickListener(this);
        this.btnReset.setOnClickListener(this);
        
        this.txtId = (EditText) this.findViewById(R.id.txtId);
        this.txtPassword = (EditText) this.findViewById(R.id.txtPassword);
        
        
    }

	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		if(v==btnSignIn) {
			String id = this.txtId.getText().toString();
			String password = this.txtPassword.getText().toString();
			if(id.length()!=0 && password.length()!=0) {
				if(id.equals("admin") && password.equals("admin")) {
					Intent intent = new Intent(this,android.chatApp.ViewContactListActivity.class);
					startActivity(intent);
				}
			}
		} else if(v==btnReset) {
			this.txtId.setText("");
			this.txtPassword.setText("");
		}
	}
}